Documentation for class object

Inherits from 

Properties declared in object 

Class Methods declared in object 
	all_class_method_names 
	all_method_names 
	all_subs 
	class 
	class_method_names 
	inspect 
	instances 
	method_names 
	name 
	object_named(symbol) 
	subs 
	super_class 
	super_classes 
	super_name 
	super_names 

Methods declared in object 
	any 
		as_string 
		class 
		class_name 
		does_not_recognize(message) 
		error_print 
		is_built_in 
		is_equal_to(object) 
		is_false 
		is_greater_than(object) 
		is_greater_than_or_equal(object) 
		is_kind_of(class_name) 
		is_kind_of_class(class) 
		is_less_than(object) 
		is_less_than_or_equal(object) 
		is_same_as(object) 
		is_true 
		perform(message_name, argument_list) 
		print 
		understands(message_name) 
		wrong_number_of_arguments(name, actual_count, formal_count) 
	predicates 
		is_built_in 
		is_false 
		is_not_false 
		is_true 

Class 
#begin_class
object 
The class object is the root class in CraftMan. 
The class object has no superclass. All other classes are subclasses of object.
It contains all the methods and class methods that all classes share.
#end_class

Properties 

Methods 

#begin_method
as_string 
Returns the object as a string.
Ex:
{button}:new:rename(#b)
{button b}:as_string
returns "{button b}"
{window}:as_string
returns "{window}"
#end_method

#begin_method
class 
Returns the class of the object.
Ex:
12:class
returns {small_integer}
"abc":class
returns {string}
{string}:class
returns {class}
#end_method

#begin_method
class_name 
Returns name of the object's class as a symbol.
Ex:
12:class_name
returns #small_integer
"abc":class_name
returns #string
{string}:class_name
returns #class
#end_method

#begin_method
does_not_recognize(message) 
When an object does not recognize a message that is sent to it, the system sends does_not_recognize to the object. You may want to create your own does_not_recognize method. The default behavior is to show a panel.
Ex:
a := "hello"
a:set_height(12)
will show a panel saying: 
"hello" does not understand the message set_height.
a:does_not_recognize(#foo)
will show a panel saying: 
"hello" does not understand the message foo.
#end_method

#begin_method
error_print 
Sets the string that will be used in the panel if an exception is raised.
Ex:
if true then "My error":error_print raise #my_error end if
will print
Exception:
My error
#end_method

#begin_method
is_built_in 
Returns true if the object is built in. Otherwise the method returns false.
Ex:
{window}:is_built_in
returns true
{image next}:is_built_in
returns true
"hello":is_built_in
returns false
#end_method

#begin_method
is_equal_to(object) 
Returns true if object and object looks the same when printed. Otherwise the method returns false.
Ex:
12:is_equal_to(12)
returns true
"abc":is_equal_to("cdf")
returns false
Note: These are equivalent to 12 = 12 and "abc" = "cdf".
#end_method

#begin_method
is_false 
Returns false.
#end_method

#begin_method
is_greater_than(object) 
Does not have any meaning on this level. Classes that may be compared implements this method. For example character, number and string. The method is_greater_than exists in this class only to assure that sorting always works.
Returns true or false.
#end_method

#begin_method
is_greater_than_or_equal(object) 
Does not have any meaning on this level. Classes that may be compared implements this method. For example character, number and string. The method is_greater_than_or_equal exists in this class only to assure that sorting always works.
Returns true or false.
#end_method

#begin_method
is_kind_of(class_name) 
Returns true if the object is an instance of the class identified by the symbol class_name or a sub-class of it. Otherwise the method returns false.
Ex:
a := "hello"
a:is_kind_of(#string)
returns true
a:is_kind_of(#character)
returns false
#end_method

#begin_method
is_kind_of_class(class) 
Returns true if the object is an instance of class or a sub-class of it. Otherwise the method returns false.
Ex:
a := "hello"
a:is_kind_of_class({string})
returns true
a:is_kind_of_class({character})
returns false
#end_method

#begin_method
is_less_than(object) 
Does not have any meaning on this level. Classes that may be compared implements this method. For example character, number and string. The method is_less_than exists in this class only to assure that sorting always works.
Returns true or false.
#end_method

#begin_method
is_less_than_or_equal(object) 
Does not have any meaning on this level. Classes that may be compared implements this method. For example character, number and string. The method is_less_than_or_equal exists in this class only to assure that sorting always works.
Returns true or false.
#end_method

#begin_method
is_same_as(object) 
Returns true if object is the same object as the object. Otherwise the method returns false.
Ex:
a := "hello"
b := "hello"
c := a
a:is_same_as(a)
returns true
a:is_same_as(b)
returns false
a:is_same_as(c)
returns true
These are equivalent to a == a, a == b and a == c.
Note: a and b are two different string objects with the same characters.
#end_method

#begin_method
is_true 
Returns false.
#end_method

#begin_method
perform(message_name, argument_list) 
Sends the message identified by the symbol message_name and the arguments in the collection argument_list to the object.
Ex:
s := "a string"
s:perform(#replace, [\i \o])
returns "a strong"
Note: This is equivalent to s:replace(\i, \o)
#end_method

#begin_method
print 
Prints the object in the Console window.
Note: print(x) is equivalent to x:print.
Ex:
for x from 1 to 5 do print(x) end for
will print
1
2
3
4
5
5
in the Console window.
Note: The last 5 is the return value from the for-loop.
Returns self.
#end_method

#begin_method
understands(message_name) 
Returns true if the object understands the message identified by the symbol message_name. Otherwise the method returns false.
Ex:
"hello":understands(#length)
returns true
"hello":understands(#set_height)
returns false
#end_method

#begin_method
wrong_number_of_arguments(name, actual_count, formal_count) 
When an object receives a message with the wrong number of arguments, the system sends wrong_number_of_arguments to the object. You may want to create your own wrong_number_of_arguments method. The default behavior is to show a panel.
Ex:
a := "hello"
a:replace(\a, \b, \c)
will show a panel saying (or print in the Console): 
"hello" was sent the message replace with wrong number of arguments--3 instead of 2 !
a:wrong_number_of_arguments(#foo, 3, 5)
will show a panel saying (or print in the Console): 
"hello" was sent the message foo with wrong number of arguments--5 instead of 3 !
#end_method

Class Methods 

#begin_class_method
all_class_method_names 
Returns a collection of the names of all the class methods of the class, including inherited methods.
Ex:
{object}:all_class_method_names
returns [#all_class_method_names #all_method_names #all_subs #class #class_method_names #inspect #instances #method_names #name #object_named #subs #super_class #super_classes #super_name #super_names]
#end_class_method

#begin_class_method
all_method_names 
Returns a collection of the names of all the methods of the class, including inherited methods.
Ex:
{object}:all_method_names
returns [#as_string #class #class_name #does_not_recognize #error_print #is_built_in #is_equal_to #is_false #is_greater_than #is_greater_than_or_equal #is_kind_of #is_kind_of_class #is_less_than #is_less_than_or_equal #is_not_false #is_same_as #is_true #perform #print #understands #wrong_number_of_arguments]
#end_class_method

#begin_class_method
all_subs 
Returns a collection of all the subclasses of the class, including subclasses of the subclasses.
Ex:
{window_object}:all_subs
returns [{menu} {miniwindow} {window} {panel} {fullscreen_window}]
#end_class_method

#begin_class_method
class 
Returns {class}.
#end_class_method

#begin_class_method
class_method_names 
Returns a collection of names of all the class methods of the class.
Ex:
{object}:class_method_names
returns [#all_class_method_names #all_method_names #all_subs #class #class_method_names #inspect #instances #method_names #name #object_named #subs #super_class #super_classes #super_name #super_names]
#end_class_method

#begin_class_method
inspect 
Opens the class inspector for the class.
#end_class_method

#begin_class_method
instances 
Returns a collection of all the instances of the class.
Note: This method returns nil for basic objects, i.e. you cannot get all the integers in your program by typing {integer}:instances.
#end_class_method

#begin_class_method
method_names 
Returns a collection of names of all the methods of the class.
Ex:
{object}:method_names
returns [#as_string #class #class_name #does_not_recognize #error_print #is_built_in #is_equal_to #is_false #is_greater_than #is_greater_than_or_equal #is_kind_of #is_kind_of_class #is_less_than #is_less_than_or_equal #is_not_false #is_same_as #is_true #perform #print #understands #wrong_number_of_arguments]
#end_class_method

#begin_class_method
name 
Returns the name of the class as a symbol.
Ex:
{slide}:name
returns #slide
#end_class_method

#begin_class_method
object_named(symbol) 
Returns the instance of the class with the name symbol. If there is no such instance the method returns nil.
Ex:
{slide}:new:rename(#my_slide)
{slide}:object_named(#my_slide)
returns {slide my_slide}
{slide}:object_named(#my_foo)
returns nil
#end_class_method

#begin_class_method
subs 
Returns a collection of the subclasses of the class.
Ex:
{window_object}:subs
returns [{menu} {miniwindow} {window}]
#end_class_method

#begin_class_method
super_class
Returns the superclass of the class.
Ex:
{window}:super_class
returns {window_object}
#end_class_method

#begin_class_method
super_classes 
Returns a collection of all the superclasses of the class.
Ex:
{window}:super_classes
returns [{window_object} {complex_object} {object}]
#end_class_method

#begin_class_method
super_name 
Returns the name of the superclass of the class as a symbol.
Ex:
{window}:super_name
returns #window_object
#end_class_method

#begin_class_method
super_names 
Returns a collection of the names of all the superclasses of the class as symbols.
Ex:
{window}:super_names
returns [#window_object #complex_object #object]
#end_class_method